From: Christian Hergert Date: Tue, 17 May 2022 19:28:25 +0000 (-0700) Subject: checkbutton: fix critical when setting use-underline X-Git-Tag: archive/raspbian/4.8.3+ds-2+rpi1~3^2~20^2~4^2~181^2 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=b9574e119bfe03530ee2f8ed82663fa81ceb2b30;p=gtk4.git checkbutton: fix critical when setting use-underline This needs to make sure that we've created the label before applying the setting on a child widget. Fixes #4934 --- diff --git a/gtk/gtkcheckbutton.c b/gtk/gtkcheckbutton.c index c97fa815e1..12a08b4452 100644 --- a/gtk/gtkcheckbutton.c +++ b/gtk/gtkcheckbutton.c @@ -959,7 +959,7 @@ gtk_check_button_set_label (GtkCheckButton *self, gtk_label_set_use_underline (GTK_LABEL (child), priv->use_underline); gtk_check_button_real_set_child (self, GTK_WIDGET (child), LABEL_CHILD); } - + gtk_widget_add_css_class (GTK_WIDGET (self), "text-button"); gtk_label_set_label (GTK_LABEL (priv->child), label); } @@ -1099,7 +1099,7 @@ gtk_check_button_set_use_underline (GtkCheckButton *self, return; priv->use_underline = setting; - if (priv->child_type == LABEL_CHILD) + if (priv->child_type == LABEL_CHILD && priv->child != NULL) gtk_label_set_use_underline (GTK_LABEL (priv->child), priv->use_underline); g_object_notify_by_pspec (G_OBJECT (self), props[PROP_USE_UNDERLINE]);